﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using DiamondDesktop.Presenters;
using DiamondDesktop.type;
using DiamondDesktop.Model;

namespace DiamondDesktop.Views
{
    /// <summary>
    /// Interaction logic for TaskListView.xaml
    /// </summary>
    public partial class TaskListView : UserControl
    {
        private DiamondDesktop.Model.Reminder r;
        private SortType type = SortType.DEADLINE;

        public TaskListView(TaskListPresenter presenter)
        {
            InitializeComponent();
            DataContext = presenter;
            r = Reminder.getInstance();
        }


        //重新得到任务列表，并将任务显示在listbox里
        private void updatelist() {
            this.listBox1.ItemsSource = r.getTodayTasks(type);     
        }

        //组建载入后事件响应
        //刷新任务列表
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            updatelist();
        }


    }
}
